1. Field of the Invention
The present invention relates to a method and an apparatus for video coding, and more particularly, to a method and an apparatus for discrete cosine transform coefficient prediction.
2. Description of the Related Art
A digital video clip can be regarded as a series of still digital images, which may be seen as continuous video images due to the temporary vision effect in human eyes when the digital video clip is continuously played. However, if the digital video is not compressed yet, great storage space and high transmission bandwidth are required. Take a 15 frames/sec of 90-minutes full color digital video with a size of 640×480 for example, the bandwidth is:640*480(pixels/frame)*3(bytes/pixel)*15(frames/sec)=13824000 bytes/sec=13.18 MB/secand the space for storage is: 13.18*90*60=69.50 GB.Obviously, it is not good enough, thus various technology for digital video compression are developed.
A method had been proposed in the prior art, where a discrete cosine transform (DCT) is utilized to transfer a frame from a spatial domain to a frequency domain, such that the high frequency signal therein is eliminated and the data is compressed.
It is common in processing the video that each of the frames is divided into a plurality of 16×16 macro-blocks as shown in FIG. 1A. Wherein, each macro-block comprises a plurality of blocks as shown in FIG. 1C, which is derived from the MPEG4 ISO/IEC 14469-2 specification. In accordance with the MPEG4 specification, a 16×16 macro-block is divided into four (8×8) blocks. Then, the discrete cosine transform process is sequentially performed on each of the (8×8) blocks in the macro-block as shown in FIG. 1B. The spatial energy after the transformation is concentrated on the values of a few low-frequency (on the top-left corner), and the coefficients of high-frequency almost approaches zero (on the bottom-right corner). Then, the coefficient of high-frequency is reduced to zero as much as possible by means of quantization. In FIG. 1B, M(0, 0) is referred as a DC item, and all the other 63 items are referred as AC items. Wherein, the DC item represents an average luminance of the entire block, and other AC items represent the tiny variance of the block.
Since the colors of the neighboring points are very close, a method called AC prediction had been proposed in the prior art as shown in FIG. 2, in which the AC item of the neighboring block is directly being substituted for the AC item of the block if the DC item of the block is close to the DC item of the neighboring block. The DC item of the block B1 is compared with the DC item of the neighboring block B2 and the DC item of the block B3. If the DC item of the neighboring block B3 is similar to the DC item of the block B1 than that of the neighboring block B2, the whole column of the AC values of block B3 are used as the prediction values, which are then directly being substituted to the block B1. However, if the AC prediction mode is applied on an image that has too many variances and lacks the spatial correlation, the compression efficiency is lowered.
FIG. 3 schematically shows a physical application of a conventional video compression technology. Referring to FIG. 3, first, a discrete cosine transform process 301 is performed on the block, and then a quantization process 303 is performed on the transformed block. Then, an AC prediction mode variable length coding (VLC) 305 and a non-AC prediction mode variable length coding (VLC) 307 are simultaneously applied on the block, and all results are stored in the memory. Finally, a coding mode with fewer number of bits is selected in the selector 309, such that the video compression is effectively accomplished. However, a great amount of memory is required in such method and the mode is not determined until the block is fully coded.